export default {
  state: {
    // 控制表单开关
    isCollapse: false,
    // 配置面包屑
    tabList: [
      {
        path: '/home',
        name: 'home',
        label: '首页',
        icon: 's-home',
        url: 'Home/Home'
      },
    ]
  },
  mutations: {
    ISCOLLAPSE(state) {
      state.isCollapse = !state.isCollapse;
    },
    ISTABLIST(state, val) {
      if (val.path !== '/home') {
        // 判断当前页面是否存在
        let index = state.tabList.findIndex(item => item.path === val.path)
        if (index === -1) {
          state.tabList.push(val)
        }
      }
    },
    REMAVELIST(state, val) {
      let index = state.tabList.findIndex(item => item.path === val.path)
      state.tabList.splice(index, 1);
    }
  }
}